package cn.rengy.web.framework.principal;

import java.io.Serializable;
import java.security.Principal;

import lombok.ToString;
@ToString
public abstract class Identity implements Principal, Serializable{
	
	private static final long serialVersionUID = 1L;
	private Long userid;
	public abstract Long getAuthid();
	public abstract String getClientId();
	public boolean equals(Object another) {
		if (another == null) {
			return false;
		}
        if (this == another) {
        	return true;
        }
        if (!(another instanceof Principal)) {
        	return false;
        }
        Identity that = (Identity) another;
        if (this.getName().equals(that.getName())) {
        	return true;
        }
        return false;
    }
 
    public int hashCode() {
        return getName().hashCode();
    }


	@Override
	public String getName() {
		return userid.toString();
	}


	public Long getUserid() {
		return userid;
	}

	public void setUserid(Long userid) {
		this.userid = userid;
	}

}
